# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")

package(
    default_visibility = ["//visibility:public"],
    features = ["layering_check"],
)

licenses(["notice"])

cc_library(
    name = "include_cleaner",
    srcs = glob([
        "lib/*.h",
        "lib/*.cpp",
    ]),
    hdrs = glob(["include/clang-include-cleaner/*.h"]),
    includes = ["include/"],
    deps = [
        "//clang:ast",
        "//clang:basic",
        "//clang:format",
        "//clang:frontend",
        "//clang:lex",
        "//clang:tooling_core",
        "//clang:tooling_inclusions",
        "//llvm:Support",
    ],
)

cc_library(
    name = "include_cleaner_internal",
    hdrs = glob(["lib/*.h"]),
    includes = ["lib/"],
    visibility = [":__subpackages__"],
    deps = [
        ":include_cleaner",
        "//clang:ast",
        "//clang:basic",
        "//clang:frontend",
        "//clang:lex",
        "//clang:tooling_inclusions",
        "//llvm:Support",
    ],
)

cc_binary(
    name = "clang-include-cleaner",
    srcs = glob([
        "tool/*.cpp",
    ]),
    deps = [
        ":include_cleaner",
        ":include_cleaner_internal",
        "//clang:frontend",
        "//clang:lex",
        "//clang:tooling",
        "//llvm:Support",
    ],
)
